/* 
 * xiaodu
 * 690898325@qq.com
 *http://www.sameus.com
 */

    function $Gid(name,value){
        if(value != null){
            document.getElementById(name).id = value;
        }
       return document.getElementById(name); 
    } 
    function $Gname(name,value){
        if(value != null){
            document.getElementsByName(name) = value;
        }
       return document.getElementsByName(name) ; 
    } 
    function $Gtagname(name,value){
        if(value != null){
            document.getElementsByTagName(name) = value;
        }
       return document.getElementsByTagName(name) ; 
    } 
    function $Gtitle(name,value){
        if(value != null){
             $Gid(name).title = value;
             return  $Gid(name); 
        }else{
             return  $Gid(name).title; 
        } 
    } 
    function $Gstyle(name){
        return  $Gid(name).style ;
    }
    function $Gbackground(name,value){
        if(value != null){
             $Gstyle(name).background = value;
             return $Gstyle(name) ; 
        }else{
             return  $Gstyle(name).background; 
        } 
    }
    function $GbackgroundColor(name,value){
        if(value != null){
             $Gstyle(name).backgroundColor = value;
             return $Gstyle(name) ; 
        }else{
             return  $Gstyle(name).backgroundColor; 
        } 
    }
    function $Gborder(name,value){
        if(value != null){
             $Gstyle(name).border = value;
             return $Gstyle(name) ; 
        }else{
             return  $Gstyle(name).border; 
        } 
    }
    function $Gmargin(name,value){
        if(value != null){
             $Gstyle(name).margin = value;
             return $Gstyle(name) ; 
        }else{
             return  $Gstyle(name).margin; 
        } 
    }
    function $Gpadding(name,value){
        if(value != null){
             $Gstyle(name).padding = value;
             return $Gstyle(name) ; 
        }else{
             return  $Gstyle(name).padding ; 
        } 
    }
    function $Gclear(name,value){ 
        if(value != null){
             $Gstyle(name).clear = value;
             return $Gstyle(name) ; 
        }else{
             return  $Gstyle(name).clear ; 
        } 
    }
    function $Gtop(name,value){ 
        if(value != null){ 
             $Gstyle(name).top = parseInt(value)+"px";
             return $Gstyle(name) ; 
        }else{
             return  $Gstyle(name).top ; 
        } 
    }
    function $Gleft(name,value){ 
        if(value != null){
             $Gstyle(name).left = parseInt(value)+"px";
             return $Gstyle(name) ; 
        }else{
             return  $Gstyle(name).left ; 
        } 
    }
    function $Gofftop(name,value){ 
        var t;
        var gid = $Gid(name);
        if(value != null){
             gid.offsetTop = value;
             return gid ; 
        }else{  
            t = gid.offsetTop ;
//            while (gid = gid.offsetParent) {
//                t += gid.offsetTop;  
//            }
             return   t; 
        } 
    }
    function $Goffleft(name,value){ 
        var l;
        var gid = $Gid(name);
        if(value != null){
             gid.offsetLeft = value;
             return gid; 
        }else{
            l = gid.offsetLeft ;
//            while (gid = $Gstyle(name).offsetParent) { 
//                l += gid.offsetLeft; //叠加父容器的左边距
//            }
             return  l ; 
        } 
    }
    function $Gshow(name){
         $Gstyle(name).display= 'block';
    }
    function $Ghide(name){
         $Gstyle(name).display= 'none';
    }
